package com.shuangti.storage.service.impl;

import com.shuangti.storage.mapper.StorageTblMapper;
import com.shuangti.storage.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;

@Service
public class StorageServiceImpl implements StorageService {

    @Autowired
    StorageTblMapper storageTblMapper;

    @Transactional
    @Override
    public void deduct(Long product_id, int stock) {
        storageTblMapper.deduct(product_id,stock);
    }

    @Transactional
    @Override
    public BigDecimal getPrice(Long product_id) {
        return storageTblMapper.selectPriceById(product_id);
    }
}
